<?php


class property_search_box
{
	protected	$_group = 1;
	protected	$_limit = 12;
	protected	$_role_id = 107;
	protected	$_DBconn;
	protected	$_front_template;
	protected	$_view;
	protected	$_business_type_db;
	protected	$_currency;
	protected	$_cat_Info;
	protected	$_mem_db;
	protected	$_country_db;
	protected	$translator;
	protected	$postValue;
	protected 	$_global_conf;
	protected	$_active =	1;
	

	
	public function __construct($view) 
	{
		$this->_front_template = Zend_Registry::get('front_template'); 
		$this->_view =	$view;
		
		//DB Connection
		$this->_DBconn = Zend_Registry::get('msqli_connection');
		$this->_DBconn->getConnection();
		
		$this->translator  = Zend_Registry::get('translator');
		
		$frontController = Zend_Controller_Front::getInstance();		
		
		//DD Class
		$this->_global_conf 		= Zend_Registry::get('global_conf');
		$this->_currency 	= new Zend_Currency($this->_global_conf['default_locale']);
		$this->_business_type_db = new Property_Model_DbTable_BusinessType();
		$this->_cat_Info 	= new Property_Model_DbTable_Category();
		$this->_mem_db 		= new Members_Model_DbTable_MemberList();
		$this->_country_db 	= new Property_Model_DbTable_Country();
		$this->postValue 	= $frontController->getRequest()->getPost();
	}
	
	public function truncate($phrase,$start_words, $max_words)
	{
	   $phrase_array = explode(' ',$phrase);
	   if(count($phrase_array) > $max_words && $max_words > 0)
		  $phrase = implode(' ',array_slice($phrase_array, $start_words, $max_words)).'...';  
	   return $phrase;
	}
	
	public function class_body()
	{
		$version = Zend_Registry::get('version');
		$translator = Zend_Registry::get('translator');
		$property_db = new Property_Model_DbTable_Properties();	
                $bathrooms = $property_db->getNumberOfBathRooms();
		$bathrooms_max = $property_db->getNumberOfBathRooms('DESC');
		$country_info = $this->_country_db->getCountryName($this->_global_conf['default_country']);
          
          
          
  
		
		$property_Country_db = new Property_Model_DbTable_Country();
		$property_State_db = new Property_Model_DbTable_State();
		$property_Area_db = new Property_Model_DbTable_Area();
		
		$businessType_BD = new Property_Model_DbTable_BusinessType();


		$global_conf = Zend_Registry::get('global_conf');
		$currency = new Zend_Currency($global_conf['default_locale']);
		
		
		$price_info_min = $property_db->getPrice('ASC');
		$price_info_max = $property_db->getPrice('DESC');
		
		$number_of_rooms_min = $property_db->getRoomNumber('ASC');
		$number_of_rooms_max = $property_db ->getRoomNumber('DESC');
		
		$property_type_ID = $property_db->getPropertyType('ASC');
		$stars = $property_db->getStars();
		$bedrooms = $property_db->getNumberOfBedsRooms();
		$bedrooms_max = $property_db->getNumberOfBedsRooms('DESC');
		$propertySize = $property_db->getPropertySize();
		$propertySize_max = $property_db->getPropertySize('DESC');
              
		
		$propertyBuildYear = $property_db->getPropertyBuildYear();
		$propertyBuildYear_max = $property_db->getPropertyBuildYear('DESC');	
		$countries = $property_Country_db->getCountryInfo ();
          
          
          
               	$select = $this->_DBconn->select()
									->from(array('up' => Zend_Registry::get('dbPrefix').'user_profile'), array('up.user_id','title' => 'up.title', 'firstName' => 'up.firstName', 'lastName' => 'up.lastName', 'companyName' => 'up.companyName', 'address' => 'up.address', 'phone' => 'up.phone', 'mobile' => 'up.mobile', 'fax' => 'up.fax'))
									->where('up.role_id = ?', $this->_role_id)
									->where('up.status = ?', '1')
									->group('up.user_id')
									->limit($this->limit)
									->joinLeft(array('pp' => Zend_Registry::get('dbPrefix').'property_page'), 'pp.property_owner = up.user_id', array('property_num' => 'COUNT(*)'));
	
		$view_datas =  $select->query()->fetchAll();
	?>

          
 <?php 
$front_template = Zend_Registry::get('front_template'); 
$this->translator = Zend_Registry::get('translator');
$global_conf = Zend_Registry::get('global_conf');
$auth = Zend_Auth::getInstance ();
$hasIdentity = $auth->hasIdentity ();
?>         


<script type="text/javascript">	


$(function() {
  $( "#property_name_box" ).autocomplete({
			source: function( request, response ) {
				$.ajax({
					url: "<?php echo $this->_view->url( array('module'=> 'Property', 'controller' => 'frontend', 'action'     => 'searchname' ), 'adminrout',    true); ?>",
					type: 'POST',
					dataType: "json",
					data: {
						property_name: request.term
					},
					success: function( data ) {
						if(data.status == 'ok')
						{
							response( $.map( data.search_data, function( item ) {
								var property_primary_image	= item.property_primary_image;
								var property_image	= item.property_image;
								var img_arr = (property_primary_image)? property_primary_image.split(',') : property_image.split(',');
								var room = item.property_location.split('<br />');
								return {
									label: item.property_name,
									value: item.property_name,
									pic: '<img src="data/frontImages/property/property_image/'+img_arr[0]+'" width="25" height="20" />',
									room:item.property_room,
									owner:item.owner_name,
									location: room[1]
								}
							}));
						}
						else
						{
							response( $.map( data, function( item ) {
								return 
							}));
						}
					}
				});
			},
			minLength: 2,
			open: function() {
				$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
			},
			close: function() {
				$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
			}
		})
		.data( "autocomplete" )._renderItem = function( ul, item ) {
			return $( "<li></li>" )
				.data( "item.autocomplete", item )
				.append( "<a>" + item.pic+ " " + item.label  + item.owner + " " + item.room + "<?php echo "&nbsp;yrs"; ?></a>" )
				.appendTo( ul );
		};		
	
	
 }); 
</script>

<div class="block block-sidebar-search">
  <div class="block-body">
    <div class="block-heading"><h1><?php echo $this->translator->translator('block_inner_search_title','','', $this->_front_template['theme_folder']); ?></h1></div>
	<div class="block-content-1">           
        <div class="col">    
	<form action="<?php echo $this->_view->url( array('module' => 'Property', 'controller' => 'search', 'action'     => 'items' ), 'Search-Items',    true); ?>" method="post" name="propertySearchBox" id="propertySearchBox">    	                                             
          <input type="hidden" name="group_id_=" id="group_id" value="<?php echo $this->_group; ?>" /><input type="hidden" name="active_=" id="active" value="1" />   
		<p class="name"><?php echo $this->translator->translator('block_search_name','','', $this->_front_template['theme_folder']); ?></p>
          <input name="property_name_LIKE" id="property_name_box" type="text" class="name" style="width:185px" value="<?php if(!empty($this->postValue['property_name_LIKE'])){ echo $this->postValue['property_name_LIKE']; }else{ echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); } ?>" />
        </div>
      	<!-- Feature Other Amenities to City of Work -->
          <div class="col">
        	<p><?php echo $this->translator->translator('block_search_other_amenities','','', $this->_front_template['theme_folder']); ?></p>
          	<select name="feature_other_amenities_LIKE" id="post_code_box" value="<?php if(!empty($this->postValue['feature_other_amenities_LIKE'])){ echo $this->postValue['feature_other_amenities_LIKE']; }else{ echo $this->translator->translator('block_search_jakarta','','', $this->_front_template['theme_folder']); } ?>">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <option value="jakarta"><?php echo $this->translator->translator('block_search_jakarta','','', $this->_front_template['theme_folder']); ?></option>
                <option value="surabaya"><?php echo $this->translator->translator('block_search_surabaya','','', $this->_front_template['theme_folder']); ?></option>
                <option value="medan"><?php echo $this->translator->translator('block_search_medan','','', $this->_front_template['theme_folder']); ?></option>
                <option value="bandung"><?php echo $this->translator->translator('block_search_bandung','','', $this->_front_template['theme_folder']); ?></option>
                <option value="semarang"><?php echo $this->translator->translator('block_search_semarang','','', $this->_front_template['theme_folder']); ?></option>
                <option value="ambon"><?php echo $this->translator->translator('block_search_ambon','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="balikpapan"><?php echo $this->translator->translator('block_search_balikpapan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banda aceh"><?php echo $this->translator->translator('block_search_bandaaceh','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bandar lampung"><?php echo $this->translator->translator('block_search_bandarlampung','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banjar"><?php echo $this->translator->translator('block_search_banjar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banjar baru"><?php echo $this->translator->translator('block_search_banjarbaru','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="banjarmasin"><?php echo $this->translator->translator('block_search_banjarmasin','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="batam"><?php echo $this->translator->translator('block_search_batam','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="batu"><?php echo $this->translator->translator('block_search_batu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="baubau"><?php echo $this->translator->translator('block_search_baubau','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bekasi"><?php echo $this->translator->translator('block_search_bekasi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bengkulu"><?php echo $this->translator->translator('block_search_bengkulu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bima"><?php echo $this->translator->translator('block_search_bima','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="binjai"><?php echo $this->translator->translator('block_search_binjai','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bitung"><?php echo $this->translator->translator('block_search_bitung','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="blitar"><?php echo $this->translator->translator('block_search_blitar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bogor"><?php echo $this->translator->translator('block_search_bogor','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bontang"><?php echo $this->translator->translator('block_search_bontang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="bukittinggi"><?php echo $this->translator->translator('block_search_bukittinggi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="cilegon"><?php echo $this->translator->translator('block_search_cilegon','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="cimahi"><?php echo $this->translator->translator('block_search_cimahi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="cirebon"><?php echo $this->translator->translator('block_search_cirebon','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="denpasar"><?php echo $this->translator->translator('block_search_denpasar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="depok"><?php echo $this->translator->translator('block_search_depok','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="dumai"><?php echo $this->translator->translator('block_search_dumai','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="gorontalo"><?php echo $this->translator->translator('block_search_gorontalo','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="gunung sitoli"><?php echo $this->translator->translator('block_search_gunungsitoli','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="jambi"><?php echo $this->translator->translator('block_search_jambi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="jayapura"><?php echo $this->translator->translator('block_search_jayapura','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kediri"><?php echo $this->translator->translator('block_search_kediri','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kendari"><?php echo $this->translator->translator('block_search_kendari','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kota klaten"><?php echo $this->translator->translator('block_search_kotaklaten','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kotamobagu"><?php echo $this->translator->translator('block_search_kotamobagu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kupang"><?php echo $this->translator->translator('block_search_kupang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="langsa"><?php echo $this->translator->translator('block_search_langsa','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="lhokseumawe"><?php echo $this->translator->translator('block_search_lhokseumawe','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="lubuklinggau"><?php echo $this->translator->translator('block_search_lubuklinggau','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="madiun"><?php echo $this->translator->translator('block_search_madiun','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="magelang"><?php echo $this->translator->translator('block_search_magelang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="makassar"><?php echo $this->translator->translator('block_search_makassar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="malang"><?php echo $this->translator->translator('block_search_malang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="manado"><?php echo $this->translator->translator('block_search_manado','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="mataram"><?php echo $this->translator->translator('block_search_mataram','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="metro"><?php echo $this->translator->translator('block_search_metro','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="mojokerto"><?php echo $this->translator->translator('block_search_mojokerto','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="padang"><?php echo $this->translator->translator('block_search_padang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="padang sidempuan"><?php echo $this->translator->translator('block_search_padangsidempuan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pagaralam"><?php echo $this->translator->translator('block_search_pagaralam','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palangkaraya"><?php echo $this->translator->translator('block_search_palangkaraya','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palembang"><?php echo $this->translator->translator('block_search_palembang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palopo"><?php echo $this->translator->translator('block_search_palopo','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="palu"><?php echo $this->translator->translator('block_search_palu','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pangkalpinang"><?php echo $this->translator->translator('block_search_pangkalpinang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="parepare"><?php echo $this->translator->translator('block_search_parepare','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pasuruan"><?php echo $this->translator->translator('block_search_pasuruan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="payakumbuh"><?php echo $this->translator->translator('block_search_payakumbuh','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pakalongan"><?php echo $this->translator->translator('block_search_pakalongan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pekanbaru"><?php echo $this->translator->translator('block_search_pekanbaru','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pematangsiantar"><?php echo $this->translator->translator('block_search_pematangsiantar','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="pontianak"><?php echo $this->translator->translator('block_search_pontianak','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="prabumulih"><?php echo $this->translator->translator('block_search_prabumulih','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="probolinggo"><?php echo $this->translator->translator('block_search_probolinggo','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="purwokerto"><?php echo $this->translator->translator('block_search_purwokerto','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="salatiga"><?php echo $this->translator->translator('block_search_salatiga','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="samarinda"><?php echo $this->translator->translator('block_search_samarinda','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="serang"><?php echo $this->translator->translator('block_search_serang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="singkawang"><?php echo $this->translator->translator('block_search_singkawang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sorong"><?php echo $this->translator->translator('block_search_sorong','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sukabumi"><?php echo $this->translator->translator('block_search_sukabumi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="surakarta"><?php echo $this->translator->translator('block_search_surakarta','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tangerang"><?php echo $this->translator->translator('block_search_tangerang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tangerang selatan"><?php echo $this->translator->translator('block_search_tangerangselatan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tanjungbalai"><?php echo $this->translator->translator('block_search_tanjungbalai','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tanjungpinang"><?php echo $this->translator->translator('block_search_tanjungpinang','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tarakan"><?php echo $this->translator->translator('block_search_tarakan','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tasikmalaya"><?php echo $this->translator->translator('block_search_tasikmalaya','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tebingtinggi"><?php echo $this->translator->translator('block_search_tebingtinggi','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tegal"><?php echo $this->translator->translator('block_search_tegal','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="ternate"><?php echo $this->translator->translator('block_search_ternate','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="yogyakarta"><?php echo $this->translator->translator('block_search_yogyakarta','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="luar_negeri"><?php echo $this->translator->translator('block_search_overseas','','', $this->_front_template['theme_folder']); ?></option>
                  
                  
         </select>
      	</div>
          
          		<div class="col">
			<p><?php echo $this->translator->translator('block_search_type','','', $this->_front_template['theme_folder']); ?></p>                 
	  		<?php $type_info = $this->_business_type_db->getOptions($this->_group); ?>
      		<select name="property_type_=" id="property_type_box">
            	<option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
				<?php 
                    foreach($type_info as $info)
                    {
                        $selected = (!empty($this->postValue['property_type_=']) && $this->postValue['property_type_='] == $info['id']) ? ' selected="selected" ' : '';
                ?>
           		<option value="<?php echo $info['id']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($info['business_type']); ?></option>
            	<?php
                	}
            	?>
			</select>
		</div>

<div class="col">
			<p><?php echo $this->translator->translator('block_search_category','','', $this->_front_template['theme_folder']); ?></p>                   
			<?php $cat_data = $this->_cat_Info->getOptions($this->_group); ?>
            <select name="category_id_=" id="category_id_box">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                    foreach($cat_data as $info)
                    {
               		$selected = (!empty($this->postValue['category_id_=']) && $this->postValue['category_id_='] == $info['id']) ? ' selected="selected" ' : '';
                ?>
                <option value="<?php echo $info['id']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($info['category_name']); ?></option>
                <?php
                    }
                ?>
            </select> 
		</div>

   </div>     
   <div class="block-content-2">      
 		                          
					
     <div class="col">
       <span style="display:inline-block;">
            <p style="width:95px"><?php echo $this->translator->translator('block_search_house_name','','', $this->_front_template['theme_folder']); ?></p>
                
                  <select name="house_name_=" id="" style="width:95px">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?>
                  <option value="lajang"><?php echo $this->translator->translator('block_search_status_single','','', $this->_front_template['theme_folder']); ?></option>                              
                  <option value="menikah"><?php echo $this->translator->translator('block_search_status_married','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="Janda/Duda"><?php echo $this->translator->translator('block_search_status_widowed','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                                
       </span>
       <span  style="float:right;">
                  <!-- House name to Status -->       
                    <p style="width:95px"><?php echo $this->translator->translator('block_search_glazing','','', $this->_front_template['theme_folder']); ?></p>
                
                <select name="feature_glazing_=" id="feature_glazing" style="width:95px">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tidak_sekolah"><?php echo $this->translator->translator('block_search_glazing_no_school','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sd"><?php echo $this->translator->translator('block_search_glazing_sd','','', $this->_front_template['theme_folder']); ?></option>                              
                  <option value="smp"><?php echo $this->translator->translator('block_search_glazing_smp','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sma"><?php echo $this->translator->translator('block_search_glazing_sma','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="Perguruan_Tinggi"><?php echo $this->translator->translator('block_search_glazing_sarjana','','', $this->_front_template['theme_folder']); ?></option>
                  </select> 
       </span>
      </div> 
       <!-- Tipology to Religion -->
       <span style="display:inline-block;">
              <p><?php echo $this->translator->translator('block_search_tipology','','', $this->_front_template['theme_folder']); ?></p>               
                  <select name="property_tipology_=" id="" style="width:95px">
                    <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="islam"><?php echo $this->translator->translator('block_search_tipology_muslim','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="budha"><?php echo $this->translator->translator('block_search_tipology_buddhist','','', $this->_front_template['theme_folder']); ?></option>
                   <option value="katolik"><?php echo $this->translator->translator('block_search_tipology_catholic','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="kristen"><?php echo $this->translator->translator('block_search_tipology_christian','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="hindu"><?php echo $this->translator->translator('block_search_tipology_hindu','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="lainnya"><?php echo $this->translator->translator('block_search_tipology_other','','', $this->_front_template['theme_folder']); ?></option>
                  </select>                
                </span>  
          <!-- Dinning Space to Ethnic Origin -->           
              <span  style="float:right;"> 
              <p><?php echo $this->translator->translator('block_search_dinning_space','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="feature_dinning_space_=" id="" style="width:95px">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="jawa"><?php echo $this->translator->translator('block_search_dinning_javanese','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="sunda"><?php echo $this->translator->translator('block_search_dinning_sundanese','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="padang"><?php echo $this->translator->translator('block_search_dinning_padangnese','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="Tionghoa"><?php echo $this->translator->translator('block_search_dinning_chinese','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="batak"><?php echo $this->translator->translator('block_search_dinning_batak','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="madura"><?php echo $this->translator->translator('block_search_dinning_madurese','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="melayu"><?php echo $this->translator->translator('block_search_dinning_malay','','', $this->_front_template['theme_folder']); ?></option>
                    <option value="lainnya"><?php echo $this->translator->translator('block_search_dinning_other','','', $this->_front_template['theme_folder']); ?></option>
                  </select>                
                </span>
       
       <!-- Property Size Min to Height Min -->
                <span style="display:inline-block;">
			<p><?php echo $this->translator->translator('block_search_property_size_min','','', $this->_front_template['theme_folder']); ?></p>
			<?php $size = $property_db->getPropertySize('ASC'); ?>
            <select name="property_size_>=" id="" class="room" style="width:95px">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($size as $key=>$value)
                {
                    if(!empty($value['property_size']))
                    {
                        $selected = (!empty($this->postValue['property_size_>=']) && $this->postValue['property_size_>='] == $value['property_size']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['property_size']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['property_size']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>
              </span>
       
       <!-- Property Size to Height Max -->
           <span  style="float:right;"> 
			<p><?php echo $this->translator->translator('block_search_property_size_max','','', $this->_front_template['theme_folder']); ?></p>
			<?php $size_max = $property_db->getPropertySize('DESC'); ?>
            <select name="property_size_<=" id="" class="room" style="width:95px">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($size_max as $key=>$value)
                {
                    if(!empty($value['property_size']))
                    {
                        $selected = (!empty($this->postValue['property_size_<=']) && $this->postValue['property_size_<='] == $value['property_size']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['property_size']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['property_size']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>
          </span>
             
             <!-- Property Lot Min to Weight Min-->
             <span  style="display:inline-block;">
               <p><?php echo $this->translator->translator('block_search_property_lot_min','','', $this->_front_template['theme_folder']); ?></p>			
             <select name="property_lot_>=" id="" class="room" style="width:95px">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                    
                    for($i = 35; $i<=100;$i++)
                    {
                        $selected = (!empty($this->postValue['property_lot_>=']) && $this->postValue['property_lot_>='] == $i) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $i; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($i); ?></option>
                <?php
                    }
                ?>
         	</select>
             
            </span>
             <!-- Property Lot Max to Weight Max -->
             <span  style="float:right;">
               <p><?php echo $this->translator->translator('block_search_property_lot_max','','', $this->_front_template['theme_folder']); ?></p>			
             <select name="property_lot_<=" id="" class="room" style="width:95px">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                    
                    for($i = 35; $i<=100;$i++)
                    {
                        $selected = (!empty($this->postValue['property_lot_<=']) && $this->postValue['property_lot_<='] == $i) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $i; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($i); ?></option>
                <?php
                    }
                ?>
         	</select>
             
            </span>
         
                  <!-- Bathroom  Min to Age Min -->
                <span style="display:inline-block;">
			<p><?php echo $this->translator->translator('block_search_bathroom_min','','', $this->_front_template['theme_folder']); ?></p>
			<?php $bathroom = $property_db->getNumberOfBathRooms('ASC'); ?>
            <select name="feature_bathroom_>=" id="feature_bathroom_>=" class="room" style="width:95px">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($bathroom as $key=>$value)
                {
                    if(!empty($value['feature_bathroom']))
                    {
                        $selected = (!empty($this->postValue['feature_bathroom_>=']) && $this->postValue['feature_bathroom_>='] == $value['feature_bathroom']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['feature_bathroom']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['feature_bathroom']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>
              </span>
             

<!-- Bathroom  Min to Age Max -->
           <span  style="float:right;"> 
			<p><?php echo $this->translator->translator('block_search_bathroom_max','','', $this->_front_template['theme_folder']); ?></p>
			<?php $bathroom = $property_db->getNumberOfBathRooms('DESC'); ?>
            <select name="feature_bathroom_<=" id="feature_bathroom_>=" class="room" style="width:95px">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($bathroom as $key=>$value)
                {
                    if(!empty($value['feature_bathroom']))
                    {
                        $selected = (!empty($this->postValue['feature_bathroom_<=']) && $this->postValue['feature_bathroom_<='] == $value['feature_bathroom']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['feature_bathroom']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['feature_bathroom']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>
            </span>
     </div>
       <div class="block-content-3">
         <div class="col">
                  <span class="ui-widget">
                    <p><?php echo $this->translator->translator('block_search_property_code','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="property_code_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="ya"><?php echo $this->translator->translator('block_search_property_code_yes','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tidak"><?php echo $this->translator->translator('block_search_property_code_no','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                  </span>
                  </div>
                  <div class="col">
                    <!-- Price to Salary -->                    		
			<p><?php echo $this->translator->translator('block_search_price_min','','', $this->_front_template['theme_folder']); ?></p>
			<?php $min_price_arr = $property_db->getPrice('ASC'); ?>
                  <select name="property_price_>=" id="property_price_>=">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($min_price_arr as $key=>$value)
                {
                    if(!empty($value['property_price']))
                    {
                        $selected = (!empty($this->postValue['property_price_>=']) && $this->postValue['property_price_>='] == $value['property_price']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['property_price']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['property_price']); ?></option>
                <?php
                        }
                    }
                ?>
            </select> 
                  </div>
                  <div class="col">
                     <p><?php echo $this->translator->translator('block_search_price_max','','', $this->_front_template['theme_folder']); ?></p>
			<?php $max_price_arr = $property_db->getPrice('DESC'); ?>
            <select name="property_price_<=" id="property_price_<=">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                <?php
                foreach($max_price_arr as $key=>$value)
                {
                    if(!empty($value['property_price']))
                    {
                        $selected = (!empty($this->postValue['property_price_<=']) && $this->postValue['property_price_<='] == $value['property_price']) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $value['property_price']; ?>"<?php echo $selected; ?>><?php echo $this->_view->escape($value['property_price']); ?></option>
                <?php
                        }
                    }
                ?>
            </select>
                  </div>
         
                   
         <!-- Right here -->   

         
                  <div class="col">
                  <span class="ui-widget">
                    <p><?php echo $this->translator->translator('block_search_post_code','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="post_code_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="ada"><?php echo $this->translator->translator('block_search_post_code_yes','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tidak"><?php echo $this->translator->translator('block_search_post_code_no','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                  </span>
                  </div>
         <!-- feature reception to understand english -->
                 <div class="col">
                  <span class="ui-widget">
                    <p><?php echo $this->translator->translator('block_search_feature_reception','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="feature_reception_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="ya"><?php echo $this->translator->translator('block_search_feature_reception_yes','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tidak"><?php echo $this->translator->translator('block_search_feature_reception_no','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                  </span>
                  </div>
                  <div class="col">
                  <span class="ui-widget">
                    <p><?php echo $this->translator->translator('block_search_feature_furnishing','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="feature_furnishing_LIKE" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="ya"><?php echo $this->translator->translator('block_search_feature_furnishing_yes','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="tidak"><?php echo $this->translator->translator('block_search_feature_furnishing_no','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                  </span>
                  </div>
                  
                 
                  <div class="col">
                  <span class="ui-widget">
                    <p><?php echo $this->translator->translator('block_search_feature_bedroom','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="feature_bedroom_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="1"><?php echo $this->translator->translator('block_search_feature_bedroom_yes','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="2"><?php echo $this->translator->translator('block_search_feature_bedroom_no','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                  </span>
                  </div>
                 
                <div class="col">
                  <span class="ui-widget">
                    <p><?php echo $this->translator->translator('block_search_stars','','', $this->_front_template['theme_folder']); ?></p>                
                  <select name="stars_=" id="">
                  <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="1"><?php echo $this->translator->translator('block_search_stars_1','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="2"><?php echo $this->translator->translator('block_search_stars_2','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="3"><?php echo $this->translator->translator('block_search_stars_3','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="4"><?php echo $this->translator->translator('block_search_stars_4','','', $this->_front_template['theme_folder']); ?></option>
                  <option value="5"><?php echo $this->translator->translator('block_search_stars_5','','', $this->_front_template['theme_folder']); ?></option>
                  </select>
                  </span>
                  </div>


                

          <!-- Owner to Agent -->          
		<div class="col clear">
			<p><?php echo $this->translator->translator('block_search_owner','','', $this->_front_template['theme_folder']); ?></p>
           	
            <span class="ui-widget">
           	<select name="property_owner_=" id="property_owner_box">
                <option value="any"><?php echo $this->translator->translator('block_search_any','','', $this->_front_template['theme_folder']); ?></option>
             <?php
		if($hasIdentity)
		{
                foreach($view_datas as $entry)
                {
                    $selected = (!empty($this->postValue['property_owner_=']) && $this->postValue['property_owner_='] == $key) ? ' selected="selected" ' : '';
                ?>
                    <option value="<?php echo $this->_view->escape($entry['user_id']); ?>"<?php echo $selected; ?><?php echo $selected; ?>><?php echo $this->_view->escape($entry['companyName']); ?></option>
                <?php
                    }
        }
                ?>
          	</select>
          	</span>


                  <!-- Block Content 3 end right down here -->
               </div> 
         

    
               

                       
             
        <!-- End here -->
        
        <div class="btn-container">
	 <input type="submit" name="Submit" value="<?php echo $this->translator->translator('block_search_btn','','', $this->_front_template['theme_folder']); ?>" />
           <!--<a href="javascript:void(0);" class="clear_search"><?php echo $this->translator->translator('block_inner_search_clear','','', $this->_front_template['theme_folder']); ?></a>-->
                 </div>
	</form>
      
	</div>
      </div>
</div>
          
<?php
	}
}
try
{
	$property_search_box_class = new property_search_box($this);
	$property_search_box_class->class_body();
}
catch(Exception $e)
{
	echo $e->getMessage();
}
?>